The Domain Name System (DNS) is used for translating domain names into IP addresses and is an essential part of the Internet. A root domain (sometimes referred to as a “naked domain” or “apex domain”) is the top domain that is commonly subdivided into smaller domains that are sometimes referred to as subdomains. For example a root domain may be “example.com” and a subdomain may be “www.example.com”. Traditionally the root record for a domain needed to point to an IP address (either an A record for IPv4 or an AAAA record for IPv6). However tying a service to an IP address can be extremely limiting. By way of example, a new blogging platform BlogExample starts up that allows its users to use custom domains that point to the BlogExample infrastructure (either through the use of subdomains such as “customer1.blogexample.com” or other domains such as “example.net” that point to the BlogExample infrastructure). Since IP addresses are limited, as more and more customers sign up for the service more IP address are shared between multiple customers. Also, providing an IP address to each customer reduces flexibility in that it is difficult to change the IP address assigned to the customer later if the need arises without causing problems for the customer.
Virtual hosting is a technique where multiple websites (multiple domains) are hosted on a single server. Name-based virtual hosting is a technique where multiple domains share the same IP address. ISPs (Internet Service Providers) that provide hosting capabilities for relatively small websites commonly use virtual hosting as a way to share the cost of resources. Virtual hosting is also commonly used in data centers. Through the use of virtual hostnames BlogExample can return different content for different domains even hosted on the same IP address.
Since multiple domains may share the same IP address, the traffic of each individual domain may indirectly affect the other domains on that IP address. For example, if one of those domains, called “Example.net” in this example, starts to receive heavy traffic (e.g., “Example.net” is being attacked in a Denial of Service attack or otherwise experiencing a large amount of traffic), the other domains may be experiencing poor performance because they are sharing the same resource as the overwhelmed domain. Traditionally the solution in this circumstance is to either change the DNS settings for the overwhelmed domain or the other domains, which may not be practical and difficult in a business environment.
A CNAME (Canonical Name) record is an alias that allows one domain to point to another domain which eventually will resolve to an A record (or AAAA record) and IP address. Using the example above, if BlogExample had handed out a unique CNAME for every customer then there would not be a problem encountered by the shared resource. For example, BlogExample might have assigned the CNAME “x1234.blogexample.com” for “example1.com” and the CNAME “y1234.blogexample.com” for “example2.com”. “example1.com” and “example2.com” both resolve to the same IP address (if following to the end of the CNAME chain). If “example1.com” started using too many resources that adversely affects the performance of “example2.com”, BlogExample could have updated the CNAME and isolated “example1.com” from the rest of the customers on that IP address.
CNAMEs work well for subdomains like “www.example.com” and “blog.example.com”, but do not work for a root domain like “example.com” itself. RFC 1035, “Domain Names—Implementation and Specification”, November 1987, and other DNS RFCs (collectively referred herein as the DNS specification) specifies that the root record (for the root domain without any subdomain) needs to be an A record and point directly to an IP address. Since most authoritative DNS servers follow the DNS specification, they do not allow CNAME records at the root to be included. This means that with most DNS providers a subdomain CNAME that points to another domain may be established, but another domain cannot be a CNAME to the root domain. For example, you may set up a CNAME to point “www.example.com” to “x1234.BlogExample.com” but you cannot set up a CNAME from the root domain “example.com” to “x1234.BlogExample.com”.
Some providers allow their customers to include a CNAME at the root even though it violates the DNS specification. However doing so causes problems in certain circumstances where other systems are following the DNS specification.